package com.sangmo.fts.training.service;

import com.sangmo.boot.framework.plugin.dataview.crud.service.BaseViewService;
import com.sangmo.boot.framework.plugin.dataview.data.IDataViewRepo;
import com.sangmo.fts.training.model.TrainingHistory;
import com.sangmo.fts.training.repo.TrainingHistoryRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TrainingHistoryEntityService extends BaseViewService<TrainingHistory> {

    @Autowired
    private TrainingHistoryRepo trainingHistoryRepo;

    @Override
    protected IDataViewRepo<TrainingHistory> getRepo() {
        return trainingHistoryRepo;
    }

    public List<TrainingHistory> findDistinctByTrainingId(Long trainingId) {
        return trainingHistoryRepo.findByTrainingIdGroupByProcessNode(trainingId);
    }

}
